package com.kevin.demo.util;

import java.util.HashMap;
import java.util.Map;

/**
 * spring容器工具
 * 
 * @author kevin
 *
 */
public class SpringContextUtil {

	private final static Map<String, Object> context = new HashMap<>();

	public static void add(String key, Object value) {
		context.put(key, value);
	}

	@SuppressWarnings("unchecked")
	public static <T> T get(Class<T> classType) {
		return (T) context.get(classType.getName());
	}

	public static Object get(String key) {
		return context.get(key);
	}

}
